package com.wss.day06.time;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.Objects;

public class St{

        public static void main(String[] args) {
            Student stu1 = new Student("张三" , "S0001" , LocalDate.of(2000,9,6));
            Student stu2 = new Student("李四" , "S0002" , LocalDate.of(2001,10,6));
            Student stu3 = new Student("王五" , "S0003" , LocalDate.of(2000,8,26));
            Student stu4 = new Student("赵六" , "S0004" , LocalDate.of(2000,7,6));
            Student stu5 = new Student("陈七" , "S0005" , LocalDate.of(2000,12,16));

            Student[] stus = {stu1 , stu2 , stu3 , stu4 , stu5};
            System.out.println(Arrays.toString(stus));

            LocalDate birthday = null;
            for (int i = 0; i < stus.length; i++) {

                if(Objects.equals(stus[i].getName(),"张三")){
                    birthday = stus[i].getBirthday();
                    System.out.println(birthday);  //2000-09-06
                }

                if(Objects.nonNull(birthday) && stus[i].getBirthday().compareTo(birthday)<0){
                    System.out.println(stus[i]);
                }
            }
        }

    }
